﻿<%@ Page EnableEventValidation="false" Language="C#" AutoEventWireup="True" Inherits="cp_member_profile"
    CodeBehind="profile.aspx.cs" %>

<%@ Register TagPrefix="oajax" Namespace="OboutInc" Assembly="obout_AJAXPage" %> 
<%@ Register TagPrefix="owd" Namespace="OboutInc.Window" Assembly="obout_Window_NET" %>
<%@ Register TagPrefix="osb" Namespace="OboutInc.OboutSuperButton" Assembly="obout_SuperButton" %>
<%@ Register TagPrefix="oflyout" Namespace="OboutInc.Flyout2" Assembly="obout_Flyout2_NET" %>
<%@ Register TagPrefix="obout" Namespace="OboutInc.Calendar2" Assembly="obout_Calendar2_NET" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" src="/JavaScripts/jquery-1.3.2.js">
    </script>

    <script type="text/javascript">
        $("document").ready(function() {
            $("#btnOpenEditField").bind("click", function() {
                $("#div1").toggle("fast");
            });
        });
        
    </script>

    <style type="text/css">
        .tdText
        {
            font: 11px Verdana;
            color: #333333;
        }
        .option2
        {
            font: 11px Verdana;
            color: #0033cc;
            background-color: ____:#f6f9fc;
            padding-left: 4px;
            padding-right: 4px;
        }
        .tdTextLink
        {
            font: 11px Verdana;
            color: #315686;
            text-decoration: underline;
        }
        .rowEditTable
        {
            background-color: #ffffff;
            border: 3px solid #000000;
        }
        .rowEditTable td
        {
            font-family: Verdana;
            font-size: 10px;
            color: #000000;
        }
    </style>
    <link href="/App_Themes/E2GroupTheme/style.css" rel="stylesheet" type="text/css" />
</head>

<script type="text/javascript" language="javascript">
function popUpdate(eR)
{
    try
    {
        <%=Flyout1.getClientID()%>.AttachTo("form1");
        <%=Flyout1.getClientID()%>.Open();
        
        ob_post.post(null, "LoadInformation", populateEditControls);
    } 
    catch(ex){
        alert(ex);
    }
}
function popUpdate1(eR)
{
    try
    {
        <%=Flyout2.getClientID()%>.AttachTo("form1");
        <%=Flyout2.getClientID()%>.Open();
    } 
    catch(ex){
        alert(ex);
    }
}

function populateEditControls(iRecord) {
    document.getElementById("tbHoTen").value = iRecord[0].toString();
    document.getElementById("tbDiaChi").value = iRecord[1].toString();
    document.getElementById("tbSDT").value = iRecord[2].toString();
    document.getElementById("tbNgaySinh").value = iRecord[3].toString();
    document.getElementById("tbEmail").value = iRecord[4].toString();
    document.getElementById("tbNgheNghiep").value = iRecord[5].toString();
}

function addNew()
{
    ob_post.AddParam("sHoTen",document.getElementById("tbHoTen").value);
    ob_post.AddParam("sDiaChi",document.getElementById("tbDiaChi").value);
    ob_post.AddParam("sSDT",document.getElementById("tbSDT").value);
    ob_post.AddParam("sNgaySinh",document.getElementById("tbNgaySinh").value);
    ob_post.AddParam("sEmail",document.getElementById("tbEmail").value);
    ob_post.AddParam("sNgheNghiep",document.getElementById("tbNgheNghiep").value);
    
    ob_post.post(null, "SaveInformation", reload);
    ob_post.ResetParams();
}

function changePass()
{
    if (document.getElementById("tbMKMoi1").value.toString()
        != document.getElementById("tbMKMoi2").value.toString())
        {
            alert("Mật khẩu mới chưa được xác nhận đúng !!!");
            return;
        }
    if (document.getElementById("tbMKMoi1").value.toString().length < 4)
    {
        alert("Mật khẩu mới quá ngắn !!!");
        return;
    }
    
    ob_post.AddParam("sOldPass",document.getElementById("tbMKCu").value);
    ob_post.AddParam("sNewPass",document.getElementById("tbMKMoi1").value);
    ob_post.post(null, "ChangePass", thongbaosaukhidoi);
    ob_post.ResetParams();   
}

function thongbaosaukhidoi(rsl)
{
    if (rsl.toString()=="-1")
    {
        alert("Password cũ không đúng !!!");
    }
    else
    {
        alert("Đổi password thành công !!!");
    }
    <%=Flyout2.getClientID()%>.Close();
}

function reload()
{
    <%=Flyout1.getClientID()%>.Close();
    ob_post.UpdateAllPanels();
}

function onlyNumbers(evt)
{
	var e = event || evt; // for trans-browser compatibility
	var charCode = e.which || e.keyCode;

	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;

	return true; 
}
</script>

<body>
    <form id="form1" runat="server">
    <oajax:CallbackPanel id="cpNham" runat="server">
        <content>
    <asp:DetailsView ID="dvUserProfile" runat="server" AutoGenerateRows="False" CellPadding="4"
        ForeColor="#333333" GridLines="None" Height="50px" Width="510px" HorizontalAlign="Center">
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <Fields>
            <asp:BoundField DataField="TenDangNhap" HeaderText="Tên đăng nhập:" SortExpression="TenDangNhap" />
            <asp:BoundField DataField="Ten" HeaderText="Họ và tên:" SortExpression="Ten" />
            <asp:TemplateField HeaderText="Ngày sinh:">
                <ItemTemplate>
                    <asp:Label ID="lbNgaySinh" runat="server" Text='<%# Eval("NgaySinh", "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Giới tính:">
                <ItemTemplate>
                    <asp:RadioButton ID="rbtnNam" runat="server" Checked='<%# Eval("Gioitinh") %>' Text="Nữ"
                        Enabled="False" />
                    <asp:RadioButton ID="rbtnNu" runat="server" Checked='<%# !(bool)Eval("Gioitinh") %>'
                        Text="Nam" Enabled="False" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="DiaChi" HeaderText="Địa chỉ liên lạc:" SortExpression="DiaChi" />
            <asp:BoundField DataField="DienThoai" HeaderText="Điện thoại liên lạc:" SortExpression="DienThoai" />
            <asp:BoundField DataField="Email" HeaderText="Email:" SortExpression="Email" />
            <asp:BoundField DataField="NgheNghiep" HeaderText="Nghề nghiệp:" SortExpression="Nghê" />
            <asp:BoundField DataField="Diem" HeaderText="Điểm số:" SortExpression="Diem" />
            <asp:TemplateField HeaderText="Lần đăng nhập gần nhất:">
                <ItemTemplate>
                    <asp:Label ID="lbLanDangNhapGanNhat" runat="server" Text='<%# Eval("ThoiGianDangNhapTruoc", "{0:G}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:DetailsView>
    </content>
	    <loading style="text-align:center;width:485px;height:310px">
		    <table width=100% height=100% cellpadding=0 cellspacing=0>
			    <tr>
				    <td align=center valign="middle">
					    <img src="/images/loading_icons/6.gif">
				    </td>
			    </tr>
		    </table>
	    </loading>
	</oajax:CallbackPanel>
	
    
    <div runat="server" align="center">
        <osb:SuperButton runat="server" SkinStyle="mbsl" ID="btnOpenEditField" Text="Thay đổi thông tin"
            mouseClick="popUpdate(this);" PathPrefix="/App_Themes/E2GroupTheme/obout/osb_data/" />
        <osb:SuperButton runat="server" SkinStyle="mbsl" ID="SuperButton1" Text="Thay đổi mật khẩu"
            mouseClick="popUpdate1(this);" PathPrefix="/App_Themes/E2GroupTheme/obout/osb_data/" />
    </div>
    
    <oflyout:Flyout runat="server" ID="Flyout1" zIndex="20" Align="MIDDLE" Position="MIDDLE_CENTER"
        CloseEvent="NONE" OpenEvent="NONE" DelayTime="0" IsModal="true" PageOpacity="70">
        <a href="javascript:<%=Flyout1.getClientID()%>.Close()" style="left: auto; font: 11px Verdana;
            text-decoration: underline; font-weight: bolder; color: Red">[Ðóng]</a>
        <asp:Table ID="tbThongTinGD" runat="server"
            CellPadding="4" BackColor="White" Width="350">
            <asp:TableRow ID="TableRow1" runat="server" HorizontalAlign="Center">
                <asp:TableCell ID="TableCell1_1" runat="server" ColumnSpan="2" Text="Thay đổi thông tin cá nhân"
                    CssClass="Table_Search_Title"></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow2" runat="server">
                <asp:TableCell ID="TableCell2_1" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Họ và tên:
                </asp:TableCell>
                <asp:TableCell ID="TableCell2_2" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbHoTen" Width = "40" />
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow3" runat="server">
                <asp:TableCell ID="TableCell3_1" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Địa chỉ:
                </asp:TableCell>
                <asp:TableCell ID="TableCell3_2" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbDiaChi" Width = "40" />
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow4" runat="server">
                <asp:TableCell ID="TableCell4_1" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Số điện thoại:
                </asp:TableCell>
                <asp:TableCell ID="TableCell4_2" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbSDT" Width = "40" onkeypress="return onlyNumbers();" maxlength="16"/>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow5" runat="server">
                <asp:TableCell ID="TableCell5_1" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Ngày sinh:
                </asp:TableCell>
                <asp:TableCell ID="TableCell5_2" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbNgaySinh" Width = "40" />
                    <obout:Calendar ID="Calendar1" runat="server" DatePickerMode="true" TextBoxId="tbNgaySinh"
                        DatePickerImagePath="/images/calendar/icon2.gif" />
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow6" runat="server">
                <asp:TableCell ID="TableCell6_1" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Email:
                </asp:TableCell>
                <asp:TableCell ID="TableCell6_2" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbEmail" Width = "40" />
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow7" runat="server">
                <asp:TableCell ID="TableCell7_1" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Nghề nghiệp:
                </asp:TableCell>
                <asp:TableCell ID="TableCell7_2" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbNgheNghiep" Width = "40" />
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow8" runat="server">
                <asp:TableCell ID="TableCell8_1" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Center"  Width="70%"
                    ColumnSpan="2">
                    <input id="btnDongY" type="button" value="Đồng ý" onclick="addNew();"/>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </oflyout:Flyout>
    
    <oflyout:Flyout runat="server" ID="Flyout2" zIndex="20" Align="MIDDLE" Position="MIDDLE_CENTER"
        CloseEvent="NONE" OpenEvent="NONE" DelayTime="0" IsModal="true" PageOpacity="70">
        <a href="javascript:<%=Flyout2.getClientID()%>.Close()" style="left: auto; font: 11px Verdana;
            text-decoration: underline; font-weight: bolder; color: Red">[Ðóng]</a>
        <asp:Table ID="Table1" runat="server"
            CellPadding="4" BackColor="White" Width="350">
            <asp:TableRow ID="TableRow9" runat="server" HorizontalAlign="Center">
                <asp:TableCell ID="TableCell1" runat="server" ColumnSpan="2" Text="Thay đổi mật khẩu"
                    CssClass="Table_Search_Title"></asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow10" runat="server">
                <asp:TableCell ID="TableCell2" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Mật khẩu cũ:
                </asp:TableCell>
                <asp:TableCell ID="TableCell3" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbMKCu" Width = "40" type="password"/>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow11" runat="server">
                <asp:TableCell ID="TableCell4" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Mật khẩu mới:
                </asp:TableCell>
                <asp:TableCell ID="TableCell5" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbMKMoi1" Width = "40" type="password"/>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow12" runat="server">
                <asp:TableCell ID="TableCell6" runat="server" Font-Names="Times New Roman" Font-Size="Medium"
                    HorizontalAlign="Right" Width="30%">
                        Nhập lại mật khẩu mới:
                </asp:TableCell>
                <asp:TableCell ID="TableCell7" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Left" Width="70%">
                    <input id = "tbMKMoi2" Width = "40" type="password"/>
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow ID="TableRow13" runat="server">
                <asp:TableCell ID="TableCell8" runat="server" Font-Bold="true" Font-Names="Times New Roman"
                    Font-Size="Medium" ForeColor="Brown" HorizontalAlign="Center"  Width="70%"
                    ColumnSpan="2">
                    <input id="btnDongYDoiMatKhau" type="button" value="Đồng ý" onclick="changePass();"/>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </oflyout:Flyout>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    </form>
</body>
</html>
